Hệ thống bổ nhiệm bác sĩ trong PHP bằng mã nguồn

1 <?php if(!isset($_SESSION)){
2     session_start();
3     }
4 ?>
5
6 <?php include(
'header.php'); ?>
7
8
9
10
11     <!--
this is for donor registraton -->
12     <div
class="recipient_reg" style="background-color:#272327;">
13         <h3
class="text-center" style="background-color:#272327;color: #fff;">Add Doctor</h3>
14
15         <div
class="formstyle" style="float: right;padding:25px;border: 1px solid lightgrey;margin-right:320px; margin-bottom:30px;background-color: #101011;color:#d4530d;;">
16         <form enctype=
"multipart/form-data" method="post" class="text-center" style="margin-left: 110px">
17              <div
class="col-md-12">
18                     
19                     <label>
20                         <input type=
"text" name="doctor_id" value="" placeholder="doctor_id" >
21                     </label><br><br>
22                     <label>
23                         <input type=
"text" name="name" value="" placeholder="Full name" >
24                     </label><br><br>
25                     <label>
26                          <input type=
"text" name="address" value="" placeholder="address" >
27                     </label><br><br>
28                     <label>
29                          <input type=
"text" name="contact" value="" placeholder="contact" >
30                     </label><br><br>
31
32                     <label>
33                          <input type=
"email" name="email" value="" placeholder="email" >
34                     </label><br><br>
35                     
36                     <label>
37                          <
select name="expertise" >
38                                         <option>-Expert
in-</option>
39                                         <option>Medicine</option>
40                                         <option>Heart</option>
41                                         <option>Bone</option>
42                                         <option>kedney</option>
43                                         <option>Cardiologist</option>
44                                         <option>Plastic Surgeon</option>
45                                         <option>General Physician</option>
46                                         <option>Neurologist</option>
47                                     </
select>
48                     </label><br><br>
49                     <label>
50                          <input type=
"text" name="userid" value="" placeholder="userid" >
51                     </label><br><br>
52                     <label>
53                        <input type=
"text" name="fee" value="" placeholder="Fee" >
54                     </label><br><br>
55                     <label>
56                          <input type=
"file" name="t8" value="" id="t8" required>
57                     </label><br><br>
58                     
59                     <button name=
"submit" type="submit" style="margin-left:148px;margin-top: 4px;width:95px;border-radius: 3px;height: 30px">Add Doctor</button> <br>
60                 
61             </div> <!-- col-md-
12 -->
62
63
64                 </form>
65             </div>
66
67
68
69
70     </div>
71     
72     
73
74  <!-- validation and insertion -->
75
76
77             <?php
78                 
if(isset($_POST["submit"]))
79                 {
80                 $target_dir =
"doner_pic/";
81                 $target_file = $target_dir . basename($_FILES[
"t8"]["name"]);
82                 $uploadOk =
1;
83                 $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
84                 
// Check if image file is a actual image or fake image
85
86                     $check = getimagesize($_FILES[
"t8"]["tmp_name"]);
87                     
if($check !== false) {
88                       
// echo "File is an image - " . $check["mime"] . ".";
89                         $uploadOk =
1;
90                     }
else {
91                         echo
"File is not an image.";
92                         $uploadOk =
0;
93                     }
94
95                 
// Check if file already exists
96                 
if (file_exists($target_file)) {
97                     echo
"Sorry, file already exists.";
98                     $uploadOk =
0;
99                 }
100                 
//aloow certain file formats
101                     
if($imageFileType != "jpg" && $imageFileType !="png" && $imageFileType !="jpeg" && $imageFileType !="gif"){
102                         echo
"sorry, only jpg, jpeg, Png & gif files are allowed.";
103                         $uploadok=
0;
104                     }
else{
105                         
if(move_uploaded_file($_FILES["t8"]["tmp_name"], $target_file)){
106                     
// if (move_uploaded_file ($_FILES['t8']['tmp_name'], "/doner_pic/{$_FILES['t8']['name']}")) {
107                         include(
'../config.php');
108                             $s=
"INSERT INTO doctor(name,address,contact,email,expertise,userid,fee,pic) VALUES('" . $_POST["name"] . "','" . $_POST["address"] . "','" . $_POST["contact"] . "','" . $_POST["email"] . "', '" . $_POST["expertise"] . "','" . $_POST["userid"] . "','" . $_POST["fee"] . "','" . basename($_FILES["t8"]["name"]) ."')";
109                             
110                             mysqli_query($conn,$s);
111                             mysqli_close($conn);
112                             
if($s>0){
113                                 echo
"<script>alert('Record Saved');</script>";
114                             }
else{
115                                 echo
"<script>alert('Record did not save');</script>";
116                             }
117                         }
else{
118                             echo
"sorry there was an error uploading your file.";
119                         }
120                     
121                     }
122                 }
123                 ?>
124
125
126
127     <!-- validation and insertion End-->
128
129     
130
131
132
133     
134     </div><!-- containerFluid Ends -->
135
136
137
138
139     <script src=
"js/bootstrap.min.js"></script>
140
141
142     
143
144
145
146 </body>
147 </html>


Gõ tìm kiếm nhanh...